﻿@using Kovan.Model.ViewModel.Config;
@using Kovan.Library.Extensions;
@using Kovan.Model.Parameter.Config;
@{
    var items = Model as List<ENews>;
    var param = ViewBag.param as PNews;
}
<style>
    .grid .gridTbody td div
    {
        height: auto;
         padding:3px;
    }
</style>
<form id="pagerForm" method="post" action="@Url.Content("~/Manage/News")">
<input type="hidden" name="title" value="@param.title"/>
<input type="hidden" name="isIndex" value="@param.isIndex"/>
<input type="hidden" name="isView" value="@param.isView" />
<input type="hidden" name="isTop" value="@param.isTop" />
<input type="hidden" name="PageIndex" value="@param.PageIndex" />
<input type="hidden" name="PageSize" value="@param.PageSize" />
</form>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this);" action="@Url.Content("~/Manage/News")" method="post">
    <div class="searchBar">
        <table class="searchContent">
            <tr>
                <td>
                    标题：<input type="text" name="title" />
                </td>
                <td>
                    首页显示：
                    <select name="isIndex">
                        <option value="">请选择</option>
                        <option value="1" @(param.isIndex == 1 ? "selected" : "")>是</option>
                        <option value="0" @(param.isIndex == 0 ? "selected" : "")>否</option>
                    </select>
                </td>
                <td>
                    可见：
                    <select name="isView">
                        <option value="">请选择</option>
                        <option value="1" @(param.isView == 1 ? "selected" : "")>是</option>
                        <option value="0" @(param.isView == 0 ? "selected" : "")>否</option>
                    </select>
                </td>
                <td>
                    置顶：
                    <select name="isTop">
                        <option value="">请选择</option>
                        <option value="1" @(param.isTop == 1 ? "selected" : "")>是</option>
                        <option value="0" @(param.isTop == 0 ? "selected" : "")>否</option>
                    </select>
                </td>
            </tr>
        </table>
        <div class="subBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit">
                                检索</button></div>
                    </div>
                </li>
                @*<li><a class="button" href="demo_page6.html" target="dialog" mask="true" title="查询框">
                    <span>高级检索</span></a></li>*@
            </ul>
        </div>
    </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="add" href="@Url.Content("~/Manage/News/GetOperate")" target="navTab" rel="news_operate"  title="添加新闻">
                <span>添加</span></a></li>
            <li><a class="delete" href="javascript:;" onclick="NewsManage.Delete();"><span>删除</span></a></li>
        </ul>
    </div>
    <table class="table" width="100%" layouth="138" id="temp">
        <thead>
            <tr>
                <th width="3%" align="center">
                    <input type="checkbox" group="newsids" class="checkboxCtrl" />
                </th>
                <th width="5%" align="center">
                    序号
                </th>
                <th>
                    标题
                </th>
                <th width="8%" align="center">
                    标题图片
                </th>
                <th width="8%" align="center">
                    首页可见
                </th>
                <th width="8%" align="center">
                    显示
                </th>
                <th width="8%" align="center">
                    置顶
                </th>
                <th width="8%" align="center">
                    创建用户
                </th>
                <th width="8%" align="center">
                    创建日期
                </th>
                <th width="8%" align="center">
                    操作
                </th>
            </tr>
        </thead>
        <tbody>
            @if (items != null && items.Count > 0)
            {
                for (int i = 0; i < items.Count; i++)
                {
                    var item = items[i];
                <tr>
                    <td>
                        <input type="checkbox" name="newsids" value="@item.NewsBase.news_id" />
                    </td>
                    <td>
                        @(i + 1)
                    </td>
                    <td>
                        @item.NewsBase.title
                    </td>
                    <td>
                        <img width="30" height="30" src="@((string.IsNullOrEmpty(item.NewsBase.title_pic) || item.NewsBase.title_pic.ToLower().Trim() == "folder.gif") ? Url.Content("~/content/images/folder.gif") : Url.Content("~/content/Uploads/News/" + item.NewsBase.title_pic))" />
                    </td>
                    <td>
                        @(item.NewsBase.is_index == 1 ? Html.TureHtml("是") : Html.FalseHtml("否"))
                    </td>
                    <td>
                        @(item.NewsBase.is_view == 1 ? Html.TureHtml("是") : Html.FalseHtml("否"))
                    </td>
                    <td>
                        @(item.NewsBase.is_top == 1 ? Html.TureHtml("是") : Html.FalseHtml("否"))
                    </td>
                    <td>
                        @item.NewsBase.create_username
                    </td>
                    <td>
                        @(item.NewsBase.create_date.HasValue ? item.NewsBase.create_date.Value.ToString("yyyy-MM-dd") : "")
                    </td>
                    <td>
                        <a href="@Url.Content("~/Manage/News/GetOperate?id="+item.NewsBase.news_id)" target="navTab" rel="news_operate"  title="编辑新闻">
                            编辑</a>
                    </td>
                </tr>
                }
            }
        </tbody>
    </table>
    <div class="panelBar">
        <div class="pages">
            <span>显示</span>
            <select class="combox" name="PageSize" onchange="navTabPageBreak({numPerPage:this.value})">
                <option value="10" @(param.PageSize == 10 ? "selected=selected" : "")>10</option>
                <option value="20" @(param.PageSize == 20 ? "selected=selected" : "")>20</option>
                <option value="50" @(param.PageSize == 50 ? "selected=selected" : "")>50</option>
                <option value="100" @(param.PageSize == 100 ? "selected=selected" : "")>100</option>
                <option value="200" @(param.PageSize == 200 ? "selected=selected" : "")>200</option>
            </select>
            <span>条，共 @param.TotalRows 条</span>
        </div>
        <div class="pagination" targettype="navTab" totalcount="@param.TotalRows" numPerPage="@param.PageSize" pagenumshown="10"
            currentpage="@param.PageIndex">
        </div>
    </div>
</div>
<script type="text/javascript" src="@Url.Content2("~/Scripts/Manage/News/Index.js")"></script>
